<?php
/**
 * Created by PhpStorm.
 * User: Aliaksei Lazerka
 * Date: 10/14/14
 * Time: 8:38 PM
 */

global $resources;
$resources = null;

if (\message\MessageResources::hasInstance()) {
  $resources = \message\MessageResources::getInstance();
} else {
  $resources = \message\MessageResources::getInstance();
  $resources->addFile(array("conf/resource_bundle/en_resources.properties"), 'eng');
  $resources->addFile(array("conf/resource_bundle/ru_resources.properties"), 'rus');
}

/**
 * Get message by lang from file
 * @param string $key
 * @return string
 */
function getMessageByKey($key)
{
  global $resources;
  $lang = "eng";
  return $resources->getMessageByKey($key, $lang);
}